<?php 
// get block sections
foreach ($this->validBlocks as $thisBlock)
{
	$blockValues[] = Inflector::humanize($thisBlock);
	$blockLabels[] = $thisBlock;
}
$validBlocks = array_combine($blockLabels, $blockValues);
?>
<h2>Insert New Module</h2>
<script>
$(document).ready(function(){
	$("#ModuleModule").change(function(){
	    $.get(URL+"/modules/getParams/"+$("#ModuleModule").val()+'?ajax=1', function(data){
			$("#ModuleParams").html(data);
			$("#ModuleParamsFields").slideDown();
		});
	});
});

</script>

<?php echo $form->create('Module');?>

<fieldset>
<legend><?php echo __("Select Module")?></legend>
<?php echo $form->input('module', array('options'=>$availableModules));?>
<?php echo $form->hidden('name');?>
<?php echo $form->hidden('plugin');?>

<div id="ModuleParamsFields" style="display: none;">
<fieldset>
<legend><?php echo __("Parameters")?></legend>

<div id="ModuleParams">
</div>

</fieldset>
</div>

</fieldset>

<fieldset>
<legend><?php echo __("Module General Info")?></legend>
<?php echo $form->input('heading');?>
<?php echo $form->input('position', array('options'=>array($validBlocks)));?>
<?php echo $form->input('cache', array('options'=>array('0','+10 seconds','+1 hour','+1 day')));?>
<?php echo $form->input('published', array('options'=>array('1'=>__('Published'),'0'=>__('Unpublished'))));?>
<?php echo $form->input('style');?>
</fieldset>

<fieldset>
<legend><?php echo __("Show on following URL(s) [One URL per line]")?></legend>
<?php echo $form->input('showOnUrl');?>
<?php echo $form->input('exceptions');?>
</fieldset>

<?php echo $form->end(__('Add this module'));?>
